Optional warnings are enabled by using the
-w
switch. Warnings may
be captured by setting
$^
Q
to a reference to a routine that will be
called on each warning instead of printing it. See
the perlvar manpage
.
Trappable errors may be trapped using the eval operator. See
eval
.
Some of these messages are generic. Spots that vary are denoted with a
%s
,
just as in a printf format. Note that some message start with a
%s
!
The symbols "%-?@
sort before the letters, while [
and \
sort after.
perl -c
fails.
perl -c
succeeds.
-B
not implemented on filehandles
is not the same as
perl -x/foo/bar
, but /foo/bar
is not a directory
that you can chdir to, possibly because it doesn't exist.
You CAN say
but then $foo no longer contains a glob.
.bak
, or some
such.
$ENV{PATH}
, the
executable in question was compiled for another architecture, or the
#! line in a script points to an interpreter that can't be run for
similar reasons. (Or maybe your system doesn't support #! at all.)
not realizing that 777 will be interpreted as a decimal number, equivalent to 01411. Octal constants are introduced with a leading 0 in Perl, as in C.
when you meant
(or something like that).
sys$getuai
underlying the
getpwnam
operator returned an invalid UIC.
Another way is to assign to a substr() that's off the end of the string.
Note, however, that the minimal matching quantifiers, *?, +? and ?? appear to be nested quantifiers, but aren't. See the perlre manpage .
perl -x
, but no line was found in the file beginning
with #! and containing the word "perl".
*foo
), but found a reference to
something else instead. You can use the
ref()
function to find out
what kind of ref it really was. See
the perlref manpage
.
when you meant
Remember that "my" and "local" bind closer than comma.
is now misinterpreted as
because of the strict regularization of Perl 5's grammar into unary and list operators. (The old open was a little of both.) You must put parens around the filehandle, or use the new "or" operator instead of "||".
On the other hand, if you were actually hoping to treat the array element as a list, you need to look into how references work, since Perl will not magically convert between scalars and lists for you. See the perlref manpage .
<=> or C, or by not using them correctly.
See
sort
.
-
Sort subroutine didn't return single value
-
(F) A sort comparison subroutine may not return a list value with more
or less than one element. See
sort
.
-
Split loop
-
(P) The split was looping infinitely. (Obviously, a split shouldn't iterate
more times than there are characters of input, which is what happened.)
See
split
.
-
Stat on unopened file <
%s
>
-
(W) You tried to use the
stat()
function (or an equivalent file test)
on a filehandle that was either never opened or has been closed since.
-
Statement unlikely to be reached
-
(W) You did an
exec()
with some statement after it other than a
die()
.
This is almost always an error, because
exec()
never returns unless
there was a failure. You probably wanted to use
system()
instead,
which does return. To suppress this warning, put the
exec()
in a block
by itself.
-
Subroutine
%s
redefined
-
(W) You redefined a subroutine. To suppress this warning, say
{
local $^W = 0;
eval "sub name { ... }";
}
-
Substitution loop
-
(P) The substitution was looping infinitely. (Obviously, a
substitution shouldn't iterate more times than there are characters of
input, which is what happened.) See the discussion of substitution in
Quote and Quotelike Operators
.
-
Substitution pattern not terminated
-
(F) The lexer couldn't find the interior delimiter of a s/// or s{}{}
construct. Remember that bracketing delimiters count nesting level.
-
Substitution replacement not terminated
-
(F) The lexer couldn't find the final delimiter of a s/// or s{}{}
construct. Remember that bracketing delimiters count nesting level.
-
substr outside of string
-
(W) You tried to reference a
substr()
that pointed outside of a string.
That is, the absolute value of the offset was larger than the length of
the string. See
substr
.
-
suidperl is no longer needed since...
-
(F) Your Perl was compiled with
-D
SETUID_SCRIPTS_ARE_SECURE_NOW, but a
version of the setuid emulator somehow got run anyway.
-
syntax error
-
(F) Probably means you had a syntax error. Common reasons include:
A keyword is misspelled.
A semicolon is missing.
A comma is missing.
An opening or closing parenthesis is missing.
An opening or closing brace is missing.
A closing quote is missing.
Often there will be another error message associated with the syntax
error giving more information. (Sometimes it helps to turn on
-w
.)
The error message itself often tells you where it was in the line when
it decided to give up. Sometimes the actual error is several tokens
before this, since Perl is good at understanding random input.
Occasionally the line number may be misleading, and once in a blue moon
the only way to figure out what's triggering the error is to call
perl -c
repeatedly, chopping away half the program each time to see
if the error went away. Sort of the cybernetic version of S<20 questions>.
-
System V IPC is not implemented on this machine
-
(F) You tried to do something with a function beginning with "sem", "shm"
or "msg". See
semctl
, for example.
-
Syswrite on closed filehandle
-
(W) The filehandle you're writing to got itself closed sometime before now.
Check your logic flow.
-
tell()
on unopened file
-
(W) You tried to use the
tell()
function on a filehandle that was either
never opened or has been closed since.
-
Test on unopened file <
%s
>
-
(W) You tried to invoke a file test operator on a filehandle that isn't
open. Check your logic. See also
-X
.
-
That use of $[ is unsupported
-
(F) Assignment to $[ is now strictly circumscribed, and interpreted as
a compiler directive. You may only say one of
$[ = 0;
$[ = 1;
...
local $[ = 0;
local $[ = 1;
...
This is to prevent the problem of one module changing the array base
out from under another module inadvertently. See
$[
.
-
The
%s
function is unimplemented
-
The function indicated isn't implemented on this architecture, according
to the probings of Configure.
-
The
crypt()
function is unimplemented due to excessive paranoia.
-
(F) Configure couldn't find the
crypt()
function on your machine,
probably because your vendor didn't supply it, probably because they
think the U.S. Govermnment thinks it's a secret, or at least that they
will continue to pretend that it is. And if you quote me on that, I
will deny it.
-
The stat preceding
-l _
wasn't an lstat
-
(F) It makes no sense to test the current stat buffer for symbolic linkhood
if the last stat that wrote to the stat buffer already went past
the symlink to get to the real file. Use an actual filename instead.
-
times not implemented
-
(F) Your version of the C library apparently doesn't do
times()
. I suspect
you're not running on Unix.
-
Too few args to syscall
-
(F) There has to be at least one argument to
syscall()
to specify the
system call to call, silly dilly.
-
Too many args to syscall
-
(F) Perl only supports a maximum of 14 args to
syscall()
.
-
Too many arguments for
%s
-
(F) The function requires fewer arguments than you specified.
-
trailing \ in regexp
-
(F) The regular expression ends with an unbackslashed backslash. Backslash
it. See
the perlre manpage
.
-
Translation pattern not terminated
-
(F) The lexer couldn't find the interior delimiter of a tr/// or tr[][]
construct.
-
Translation replacement not terminated
-
(F) The lexer couldn't find the final delimiter of a tr/// or tr[][]
construct.
-
truncate not implemented
-
(F) Your machine doesn't implement a file truncation mechanism that
Configure knows about.
-
Type of arg %d to
%s
must be
%s
(not
%s
)
-
(F) This function requires the argument in that position to be of a
certain type. Arrays must be @NAME or @{EXPR}. Hashes must be
%NAME or %{EXPR}. No implicit dereferencing is allowed--use the
{EXPR} forms as an explicit dereference. See
the perlref manpage
.
-
umask: argument is missing initial 0
-
(W) A umask of 222 is incorrect. It should be 0222, since octal literals
always start with 0 in Perl, as in C.
-
Unbalanced context: %d more PUSHes than POPs
-
(W) The exit code detected an internal inconsistency in how many execution
contexts were entered and left.
-
Unbalanced saves: %d more saves than restores
-
(W) The exit code detected an internal inconsistency in how many
values were temporarily localized.
-
Unbalanced scopes: %d more ENTERs than LEAVEs
-
(W) The exit code detected an internal inconsistency in how many blocks
were entered and left.
-
Unbalanced tmps: %d more allocs than frees
-
(W) The exit code detected an internal inconsistency in how many mortal
scalars were allocated and freed.
-
Undefined format "
%s
" called
-
(F) The format indicated doesn't seem to exist. Perhaps it's really in
another package? See
the perlform manpage
.
-
Undefined sort subroutine "
%s
" called
-
(F) The sort comparison routine specified doesn't seem to exist. Perhaps
it's in a different package? See
sort
.
-
Undefined subroutine &
%s
called
-
(F) The subroutine indicated hasn't been defined, or if it was, it
has since been undefined.
-
Undefined subroutine called
-
(F) The anonymous subroutine you're trying to call hasn't been defined,
or if it was, it has since been undefined.
-
Undefined subroutine in sort
-
(F) The sort comparison routine specified is declared but doesn't seem to
have been defined yet. See
sort
.
-
unexec of
%s
into
%s
failed!
-
(F) The
unexec()
routine failed for some reason. See your local FSF
representative, who probably put it there in the first place.
-
Unknown BYTEORDER
-
(F) There are no byteswapping functions for a machine with this byte order.
-
unmatched () in regexp
-
(F) Unbackslashed parentheses must always be balanced in regular
expressions. If you're a vi user, the % key is valuable for finding
the matching paren. See
the perlre manpage
.
-
Unmatched right bracket
-
(F) The lexer counted more closing curly brackets (braces) than opening
ones, so you're probably missing an opening bracket. As a general
rule, you'll find the missing one (so to speak) near the place you were
last editing.
-
unmatched [] in regexp
-
(F) The brackets around a character class must match. If you wish to
include a closing bracket in a character class, backslash it or put it first.
See
the perlre manpage
.
-
Unquoted string "
%s
" may clash with future reserved word
-
(W) You used a bare word that might someday be claimed as a reserved word.
It's best to put such a word in quotes, or capitalize it somehow, or insert
an underbar into it. You might also declare it as a subroutine.
-
Unrecognized character \%03o ignored
-
(S) A garbage character was found in the input, and ignored, in case it's
a weird control character on an EBCDIC machine, or some such.
-
Unrecognized signal name "
%s
"
-
(F) You specified a signal name to the
kill()
function that was not recognized.
Say
kill -l
in your shell to see the valid signal names on your system.
-
Unrecognized switch: -
%s
-
(F) You specified an illegal option to Perl. Don't do that.
(If you think you didn't do that, check the #! line to see if it's
supplying the bad switch on your behalf.)
-
Unsuccessful
%s
on filename containing newline
-
(W) A file operation was attempted on a filename, and that operation
failed, PROBABLY because the filename contained a newline, PROBABLY
because you forgot to
chop()
or
chomp()
it off. See
chop
.
-
Unsupported directory function "
%s
" called
-
(F) Your machine doesn't support
opendir()
and
readdir()
.
-
Unsupported function
%s
-
(F) This machines doesn't implement the indicated function, apparently.
At least, Configure doesn't think so.
-
Unsupported socket function "
%s
" called
-
(F) Your machine doesn't support the Berkeley socket mechanism, or at
least that's what Configure thought.
-
Unterminated <> operator
-
(F) The lexer saw a left angle bracket in a place where it was expecting
a term, so it's looking for the corresponding right angle bracket, and not
finding it. Chances are you left some needed parentheses out earlier in
the line, and you really meant a "less than".
-
Use of $# is deprecated
-
(D) This was an ill-advised attempt to emulate a poorly defined awk feature.
Use an explicit
printf()
or
sprintf()
instead.
-
Use of $* is deprecated
-
(D) This variable magically turned on multiline pattern matching, both for
you and for any luckless subroutine that you happen to call. You should
use the new
//m
and //s
modifiers now to do that without the dangerous
action-at-a-distance effects of
$*
.
-
Use of
%s
in printf format not supported
-
(F) You attempted to use a feature of printf that is accessible only
from C. This usually means there's a better way to do it in Perl.
-
Use of
%s
is deprecated
-
(D) The construct indicated is no longer recommended for use, generally
because there's a better way to do it, and also because the old way has
bad side effects.
-
Use of implicit split to @_ is deprecated
-
(D) It makes a lot of work for the compiler when you clobber a
subroutine's argument list, so it's better if you assign the results of
a
split()
explicitly to an array (or list).
-
Use of uninitialized value
-
(W) An undefined value was used as if it were already defined. It was
interpreted as a "" or a 0, but maybe it was a mistake. To suppress this
warning assign an initial value to your variables.
-
Useless use of
%s
in void context
-
(W) You did something without a side effect in a context that does nothing
with the return value, such as a statement that doesn't return a value
from a block, or the left side of a scalar comma operator. Very often
this points not to stupidity on your part, but a failure of Perl to parse
your program the way you thought it would. For example, you'd get this
if you mixed up your C precedence with Python precedence and said
$one, $two = 1, 2;
when you meant to say
($one, $two) = (1, 2);
Another common error is to use ordinary parentheses to construct a list
reference when you should be using square or curly brackets, for
example, if you say
$array = (1,2);
when you should have said
$array = [1,2];
The square brackets explicitly turn a list value into a scalar value,
while parentheses do not. So when a parenthesized list is evaluated in
a scalar context, the comma is treated like C's comma operator, which
throws away the left argument, which is not what you want. See
the perlref manpage
for more on this.
-
Warning: unable to close filehandle
%s
properly.
-
(S) The implicit
close()
done by an
open()
got an error indication on the
close(0. This usually indicates your filesystem ran out of disk space.
-
Warning: Use of "
%s
" without parens is ambiguous
-
(S) You wrote a unary operator followed by something that looks like a
binary operator that could also have been interpreted as a term or
unary operator. For instance, if you know that the rand function
has a default argument of 1.0, and you write
rand + 5;
you may THINK you wrote the same thing as
rand() + 5;
but in actual fact, you got
rand(+5);
So put in parens to say what you really mean.
-
Write on closed filehandle
-
(W) The filehandle you're writing to got itself closed sometime before now.
Check your logic flow.
-
X outside of string
-
(F) You had a pack template that specified a relative position before
the beginning of the string being unpacked. See
pack
.
-
x outside of string
-
(F) You had a pack template that specified a relative position after
the end of the string being unpacked. See
pack
.
-
Xsub "
%s
" called in sort
-
(F) The use of an external subroutine as a sort comparison is not yet supported.
-
Xsub called in sort
-
(F) The use of an external subroutine as a sort comparison is not yet supported.
-
You can't use
-l
on a filehandle
-
(F) A filehandle represents an opened file, and when you opened the file it
already went past any symlink you are presumably trying to look for.
Use a filename instead.
-
YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!
-
(F) And you probably never will, since you probably don't have the
sources to your kernel, and your vendor probably doesn't give a rip
about what you want. Your best bet is to use the wrapsuid script in
the eg directory to put a setuid C wrapper around your script.
-
You need to quote "
%s
"
-
(W) You assigned a bareword as a signal handler name. Unfortunately, you
already have a subroutine of that name declared, which means that Perl 5
will try to call the subroutine when the assignment is executed, which is
probably not what you want. (If it IS what you want, put an & in front.)
-
[gs]etsockopt() on closed fd
-
(W) You tried to get or set a socket option on a closed socket.
Did you forget to check the return value of your
socket()
call?
See
getsockopt
.
-
\1 better written as $1
-
(W) Outside of patterns, backreferences live on as variables. The use
of backslashes is grandfathered on the righthand side of a
substitution, but stylistically it's better to use the variable form
because other Perl programmers will expect it, and it works better
if there are more than 9 backreferences.
-
'|' and '<' may not both be specified on command line
-
(F) An error peculiar to VMS. Perl does its own command line redirection, and
found that STDIN was a pipe, and that you also tried to redirect STDIN using
'<'. Only one STDIN stream to a customer, please.
-
'|' and '>' may not both be specified on command line
-
(F) An error peculiar to VMS. Perl does its own command line redirection, and
thinks you tried to redirect stdout both to a file and into a pipe to another
command. You need to choose one or the other, though nothing's stopping you
from piping into a program or Perl script which 'splits' output into two
streams, such as
open(OUT,">$ARGV[0]") or die "Can't write to $ARGV[0]: $!";
while () {
print;
print OUT;
}
close OUT;
.